package org.example.api.goods.goods.enums;

import lombok.Getter;

@Getter
public enum GoodsStatusEnum {
  /**
   * 上架中
   */
  ON_SHELVES("1","上架中"),
  /**
   * 已下架
   */
  DELISTED("2","已下架");

  final String code;
  final String desc;

  GoodsStatusEnum(String code, String desc) {
      this.code = code;
      this.desc = desc;
  }

  // 根据code获取枚举
    public static GoodsStatusEnum getByCode(String code) {
        for (GoodsStatusEnum goodsStatusEnum : GoodsStatusEnum.values()) {
            if (goodsStatusEnum.getCode().equals(code)) {
                return goodsStatusEnum;
            }
        }
        return null;
    }
}
